
#include <stdio.h>
#include <unistd.h>
#include "../compile_bsp/system.h"

volatile unsigned int *led_ptr = (unsigned int*) (LED_BASE);
volatile unsigned int *nic_ptr = (unsigned int*) (NIC_INTERFACE_BASE);


void delay(unsigned int count) {

	while(count) count--;

}

void DCT_AAN(double out[], double in[]){ //AAN - Arai, Agui and Nakajima (speed up DCT process)
        double x01, x11, x21, x31, x41, x51, x61, x71;
        double x0, x1, x2, x3;
        x01 = in[0]+in[7];
        x11 = in[1]+in[6];
        x21 = in[2]+in[5];
        x31 = in[3]+in[4];
        x41 = in[3]-in[4];
        x51 = in[2]-in[5];
        x61 = in[1]-in[6];
        x71 = in[0]-in[7];

        x0 = x01+x31;
        x1 = x11+x21;
        x2 = x11-x21;
        x3 = x01-x31;

        out[0] = 0.35355339*(x0+x1);
        out[4] = 0.35355339*(x0-x1);
        x2 = 0.707106781*(x2+x3);
        out[2] = 0.27059805*(x2+x3);
        out[6] = 0.653281482*(x3-x2);

        x0 = x41+x51;
        x1 = x51+x61;
        x2 = x61+x71;
        x3 = 0.382683432*(x0-x2);

        x41 = 0.541196100*x0+x3;
        x51 = 0.707106781*x1;
        x61 = 1.306562965*x2+x3;

        x1 = x51+x71;
        x3 = x71-x51;
        out[5] = 0.449988111*(x41+x3);
        out[1] = 0.254897789*(x1+x61);
        out[7] = 1.281457724*(x1-x61);
        out[3] = 0.300672443*(x3-x41);
}

int main()
{

 while(1){

	 *led_ptr = 0xFFFF;
	 usleep(1000000);
	 *led_ptr = 0x0000;
	 usleep(1000000);


 }






  return 0;
}
